Skip to content

fix: non-generic id check in PostAsync #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

jfhs
Copy link
Contributor

@jfhs jfhs commented Mar 15, 2017

Proposed fix for #53

@@ -12,5 +12,10 @@ object IIdentifiable.Id
get { return Id; }
set { Id = (T)value; }
}

public bool IsIdEmpty()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be virtual so users can override it. Also, since this won't work "out-of-the-box" for a lot of types. I'd like to add support for common, non-nullable types. I can work on this tonight.

@jaredcnance
Copy link
Contributor

jaredcnance commented Mar 15, 2017

@jfhs thanks for the PR! See my comments above. I can take it from here, or you can keep working on it if you want?

@jfhs
Copy link
Contributor Author

jfhs commented Mar 15, 2017

@jaredcnance you are welcome :) However I've stumbled upon another problem, again related to Id type. I will describe it here, because I think solution for both problem is linked.

I got InvalidCastException in DeSerializer apparently because string can't be casted to Guid, which is called from here

Given that and problem for checking id for empty/null, maybe a better solution would be to have methods like SetIdFromString/GetIdAsString, or just a property StringId, so that you can safely safely serialize/deserialize ids from string. Then in controller you would actually check this string representation for emptiness.

Also, I hurried a bit with PR, probably it would break your samples (at least one from the video) because for ApplicationUser you implemented interface, and now it has one more method.

I'm not sure I will be able to work any longer today, so if you want, you can just close my PR and do it yourself. If not, I will come back tomorrow, and fix it, because I need this working ASAP :)

@jaredcnance
Copy link
Contributor

Closing in favor of #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants